import java.util.Scanner;
/**
 * processing example : displaying the result of java logical operator
 * 
 * @author Amrita Mukherjee
 * @version 03/10/2012
 */
public class Example1
{
    public static void main(String[] args)
    {
        //create scanner object called "keyboard"
        Scanner keyboard = new Scanner(System.in);
        
        //tell the user what the program does
        System.out.println("\nthis program displays result of logic operators.");
        System.out.println();  //print a blank line
        
        //prompt the user for input1
        System.out.print("Is Cindy going to the party (yes/no)? ");
        String isCindyGoing = keyboard.nextLine();
        
        //prompt user for input2
        System.out.print("Is Dan going to the party (yes/No)? ");
        String isDanGoing = keyboard.nextLine();
        
        //Process: (note the java operators for AND, OR, XOR and Not)
        boolean and = isCindyGoing.startsWith("y") && isDanGoing.startsWith("y");
        boolean or = isCindyGoing.startsWith("y") || isDanGoing.startsWith("y");
        boolean xor = isCindyGoing.startsWith("y") ^ isDanGoing.startsWith("y");
        boolean nand = ! and;
        
        //Now, show the results of each of the logical operators.
        System.out.println();
        System.out.println("(Cindy is going AND Dan is going)is: " + and);
        System.out.println("(Cindy is going OR Dan is going)is: " + or);
        System.out.println("(Cindy is going XOR Dan is going)is: " + xor);
        System.out.println("(Cindy is going NAND Dan is going)is: " + nand);
        
    }
}
/*
 * My test session:
 * this program displays result of logic operators.

Is Cindy going to the party (yes/no)? yes
Is Dan going to the party (yes/No)? yes

(Cindy is going AND Dan is going)is: true
(Cindy is going OR Dan is going)is: true
(Cindy is going XOR Dan is going)is: false
(Cindy is going NAND Dan is going)is: false

this program displays result of logic operators.

Is Cindy going to the party (yes/no)? no
Is Dan going to the party (yes/No)? no

(Cindy is going AND Dan is going)is: false
(Cindy is going OR Dan is going)is: false
(Cindy is going XOR Dan is going)is: false
(Cindy is going NAND Dan is going)is: true

this program displays result of logic operators.

Is Cindy going to the party (yes/no)? yes
Is Dan going to the party (yes/No)? no

(Cindy is going AND Dan is going)is: false
(Cindy is going OR Dan is going)is: true
(Cindy is going XOR Dan is going)is: true
(Cindy is going NAND Dan is going)is: true

this program displays result of logic operators.

Is Cindy going to the party (yes/no)? no
Is Dan going to the party (yes/No)? yes

(Cindy is going AND Dan is going)is: false
(Cindy is going OR Dan is going)is: true
(Cindy is going XOR Dan is going)is: true
(Cindy is going NAND Dan is going)is: true

 */